
<?php

function ExportSysConfigFile()
{
	$config_file_tar = 'config.tar.gz';
	$config_file_cfg = 'config.xml';
	$command_tar = '/bin/tar ';
	$command_string = $command_tar. ' czf '. $config_file_tar. ' '. $config_file_cfg. ' && sync && sync';
	shell_exec($command_string);
	return $config_file_tar;
}

function SysSaveGlobConfig()
{
	$command_string = "/bin/cp -rf /usr/local/apache2/htdocs/config.xml /etc/config/config.xml 
			   && sycn && sync && sync && sync ";
	$ret_string = shell_exec($command_string);
	return $ret_string;
}

function ImportSysConfigFile($upfile)
{
	$command_string = "/bin/tar xzvf ". $upfile;
	$ret_string = shell_exec($command_string);
	return $ret_string;
}

function RestoreDefaultConfig()
{
	$command_string = "/bin/cp -rf /etc/config/default.xml /etc/config/config.xml ";
	$ret_string = shell_exec ($command_string);
	$command_string = "/bin/cp -rf /etc/config/config.xml /usr/local/apache2/htdocs/config.xml ";
	$ret_string = shell_exec ($command_string);
	$command_string = "sync && sync && sync && sync ";
	$ret_string = shell_exec ($command_string);
	$command_string = "/sbin/reboot ";
	$ret_string = shell_exec ($command_string);
	return $ret_string;
}
?>
